from typing import Optional, List
from datetime import datetime
from pydantic import BaseModel

from app.schemas.base_so import BaseListQo, BaseQo


class AIAgentBase(BaseModel):
    name: str
    description: Optional[str] = None
    emoji:str
    group: str
    system_prompt: Optional[str] = None
    summarize_prompt: Optional[str] = None
    tool_desc: Optional[str] = None
    tools: Optional[str] = None
    kb_id: Optional[int] = None
    agent_ids: Optional[str] = None
    ai_model_id: Optional[int] = None
    status: Optional[str] = None

class AIAgentCreate(AIAgentBase):
    name: str
    description: Optional[str] = None

class AIAgentUpdate(AIAgentBase):
    id: int
    name: str
    description: Optional[str] = None



from pydantic import BaseModel, Field
from typing import List, Optional

class AIApiCreate(BaseModel):
    name: str
    description: str
    remark: Optional[str] = None
    api_base: Optional[str] = None
    api_key: Optional[str] = None
    api_token: Optional[str] = None

class AIApiUpdate(AIApiCreate):
    id: int
    status: str
    is_system: str


class AIApiInitModel(BaseModel):
    group: Optional[str] = None
    name: Optional[str] = None
    description: Optional[str] = None

class AIApiInit(BaseModel):
    id: Optional[int]
    description: Optional[str] = None
    name: str
    type: str
    api_base: str
    api_key: str
    api_token:Optional[str] = None
    models:List[AIApiInitModel] = None

class AIApiListQo(BaseListQo):
    searchValue: Optional[str] = None

class AIModelCreate(BaseModel):
    ai_api_id: int
    model_group: str
    model_name: str
    description: Optional[str]
    type: str
    has_tool: str
    status: str

class AIModelUpdate(AIModelCreate):
    id: int


class AIModelListQo(BaseListQo):
    ai_api_id: int
    searchValue: Optional[str] = None


class LookupAiModelUseAiConfigQo(BaseQo):
    searchValue: Optional[str] = None



class AIToolsListQo(BaseListQo):
    searchValue: Optional[str] = None

class AIToolsCreate(BaseModel):
    id: int

class AIToolsUpdate(AIToolsCreate):
    id: int
    remark: Optional[str]
    status: str
